package main.od;

import java.util.Scanner;

public class RiceCaseSpeed {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        int[] P = new int[N];
        int count = 0;
        for (int i = 0;i < N;i++){
            P[i] = sc.nextInt();
            count += P[i];
        }
        int left = 0;
        int right = count - M;
        while (left < right){
            int mid = (left + right) / 2;
            if (check(mid,M,N,P)){
                right = mid;
            }else {
                left = mid + 1;
            }
        }
        System.out.println(left);
    }
    public static boolean check(int speed,int M,int N,int[] P){
        boolean result = true;
        for (int i = 0;i < N;i++){
            M -= P[i];
            if (M < 0){
                result = false;
                break;
            }
            M += speed;
        }
        return result;
    }
}
